<?php
/**
 * @package     Joomla.Libraries
 * @subpackage  Form
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');
 
/**
 * HelloWorld Form Field class for the HelloWorld component
 *
 * @since  0.0.1
 */
class JFormFieldCurrencies extends JFormFieldList
{
	/**
	 * The field type.
	 *
	 * @var         string
	 */
	protected $type = 'Currencies';
 
	/**
	 * Method to get a list of options for a list input.
	 *
	 * @return  array  An array of JHtml options.
	 */
	protected function getOptions()
	{
		$db			= JFactory::getDBO();
		$query		= $db->getQuery(true);

		$query->select('id');
		$query->from('#__own_currencies');
		$db->setQuery((string) $query);

		$currencies = $db->loadObjectList();
		$options	= array();
 
		if ($currencies)
		{
			foreach ($currencies as $currency)
			{
				$options[] = JHtml::_('select.option', '', '');
			}
		}
 
		$options = array_merge(parent::getOptions(), $options);
 
		return $options;
	}
}